package yf.mall.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public  class StringUtil {

    public static Boolean isBlank(String str){
        return str==null || str.trim().equals("");
    }

    public static Boolean isPhone(String phone){
        if(isBlank(phone)||phone.length()!=11){
            return false;
        }
        return true;
    }

    public static String getUrlPrefix(String urlString) {
        Pattern pattern = Pattern.compile("^(https?|ftp)://[^/]+");
        Matcher matcher = pattern.matcher(urlString);

        if (matcher.find()) {
            return matcher.group();
        } else {
            return null;
        }
    }

}
